<template>
  <header>
    <div class="header-meta">
      <span class="heading"> {{ headingMsg }} </span>
      <div class="social-bookmarks">
        <img src="@/assets/svg/twitter.svg" alt="Twitter" /> |
        <img src="@/assets/svg/linkedin.svg" alt="LinkedIn" />
      </div>
    </div>
    <div class="header-main">
      <div class="logo">
        <img src="@/assets/img/img.png" alt="logo" />
      </div>
      <div class="nav">
        <div class="nav-item" v-for="item in navData" :key="item.key">
          <a-dropdown v-if="item.isDropDown">
            <a>
              {{ item.title }}
              <DownOutlined />
            </a>
            <template #overlay>
              <div class="div-menu">
                <div
                  class="div-menu-item"
                  v-for="menuItem in item.menu"
                  :key="menuItem"
                >
                  {{ menuItem }}
                </div>
              </div>
            </template>
          </a-dropdown>
          <a v-else>
            {{ item.title }}
          </a>
        </div>
        <div class="nav-item">
          <a-popover trigger="click" placement="bottomRight">
            <template #content>
              <div class="popover-search-content">
                <input type="text" placeholder="search you want" />
                <div class="search-icon">
                  <SearchOutlined style="font-size: 18px; color: #fff"/>
                </div>
              </div>
            </template>
            <a>
              <SearchOutlined style="font-size: 18px" />
            </a>
          </a-popover>
        </div>
      </div>
    </div>
  </header>
</template>

<script setup>
import { DownOutlined } from "@ant-design/icons-vue";
import { SearchOutlined } from "@ant-design/icons-vue";
import { ref } from "vue";
const headingMsg = ref(
  "Industry association for standardizing information and communication systems"
);

const navData = ref([
  {
    key: "a",
    title: "About Ecma",
    isDropDown: true,
    menu: [
      "Mission",
      "Areas of work",
      "Organisation",
      "Members",
      "Meeting calender",
      "History",
      "Awards",
      "Join Ecma",
    ],
  },
  {
    key: "b",
    title: "Publications and standards",
    isDropDown: true,
    menu: ["standards", "Technical Reports", "Mementos", "Get Involved"],
  },
  {
    key: "c",
    title: "Committees",
    isDropDown: false,
  },
  {
    key: "d",
    title: "Policies",
    isDropDown: true,
    menu: [
      "Ecma By-lays",
      "Ecma Rules",
      "Ecma IPR policies",
      "Ecma awards policy",
    ],
  },
  {
    key: "e",
    title: "News",
    isDropDown: false,
  },
  {
    key: "f",
    title: "Contact",
    isDropDown: false,
  },
]);
</script>

<style lang="scss" scoped>
header {
  background-color: #ffffff;
  height: 150px;
  display: flex;
  left: 0;
  top: 0;
  right: 0;
  flex-direction: column;
  .header-meta {
    min-height: 30px;
    padding: 0 250px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f09339;
    .heading {
      font-size: 12px;
      font-weight: 500;
      color: white;
    }
    .social-bookmarks {
      display: flex;
      justify-content: space-between;
      align-items: center;
      filter: invert(1);
      img {
        width: 16px;
        height: 16px;
        margin: 0 5px;
        cursor: pointer;
      }
    }
  }
  .header-main {
    height: 120px;
    padding: 0 250px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .logo {
      img {
        width: 70px;
        height: 30px;
        cursor: pointer;
      }
    }
    .nav {
      height: 120px;
      display: flex;
      align-items: center;
      .nav-item {
        margin: 0 12px;
        a {
          color: #363940;
          font-size: 14px;
          &:hover {
            color: #e38134;
          }
        }
      }
    }
  }
}

.div-menu {
  background: #fff;
  box-shadow: 0 0 30px #ccc;
}

.div-menu-item {
  padding: 8px 16px;
  &:hover {
    cursor: pointer;
    background: #e38134;
  }
}

.popover-search-content {
  display: flex;
  align-items: center;
  input {
    width: 180px;
    height: 40px;
    outline: none;
    border: 1px solid #ccc;
    padding: 6px 12px;
  }
  .search-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e38134;
    height: 40px;
    width: 60px;
    cursor: pointer;
  }
}
</style>
